<template>
	<div class="examine">
		<div class="header" v-show="false">
			<router-link tag="div" to="/home" class="iconfont" >&#xe624;</router-link>
			审核结果
		</div>
		<div class="top" v-show="status == 0">
			<div class="center-img">
				<img width="100%"  src="../../assets/images/coinShop/waiting.png" />
			</div>
			<p class="status-title">提交成功，等待审核!</p>
		</div>
		<div class="top top-fail" v-show="status == -1">
			<div class="center-img">
				<img width="100%"  src="../../assets/images/coinShop/failed.png" />
			</div>
			<p class="status-title">提交成功，等待审核!</p>
		</div>
		<div class="top top-succ" v-show="status == 1">
			<div class="center-img">
				<img width="100%"  src="../../assets/images/coinShop/ok.png" />
			</div>
			<p class="status-title">恭喜您审核通过!</p>
		</div>
		<div  v-show="status == 0">
			<div class="bott">
				<p class="desc">预计1-2个工作日内审核完毕，审核结果会短信通知到您的注册手机上。</p>
			</div>
			
			<div class="link-img" @click="toU">
				<img src="../../assets/images/functions/正在审核.jpg" alt="" width="100%" height="100%"/>
			</div>
		</div>
		<div class="bott bott-fail" v-show="status == -1" style="text-align: left;">
			<h3 class="title">抱歉，您的资料审核未通过！</h3>
			<p class="desc-fail">具体原因如下</p>
			<p class="desc-fail">●{{reason}}</p>
			<p class="desc-fail">信息填写有误，请修改后重新申请</p>
			<div class="btn" @click="backPrevPage">重新编辑</div>
		</div>
		<div class="bott bott-success" v-show="status == 1">
			<div class="logo">
				<img src="../../assets/images/coinShop/logo.png" width="100%" />
			</div>
			<div v-show="dtype">
				<p class="succ-desc">恭喜你现在可以为线上商户创建宝店获取收入！</p>
				<p class="succ-desc">PC端:请登录 Maker.mofing.com进行操作</p>
				<p class="succ-desc">手机端：进入阿宝APP—我—宝店管理进行操作</p>
			</div>
			<div v-show="!dtype">
				<p class="succ-desc">请使用阿宝APP管理经营宝店并领取宝店赚钱二维码</p>
			</div>
			<div class="success-btn" v-show="isWeChat === false">安装阿宝APP</div>
			<router-link tag="div" to="/createShop" class="success-btn">去开店</router-link>
		</div>
	</div>
</template>

<script>
	import {getUrlParam}  from '@/assets/js/getUrlParam'
	export default{
		name : "examine",
		data(){
			return{
				isWeChat : false,
				status   : '',
				author   : {},
				store    : {},
				failInfo : '',
				reason   : '',
				desc     : '',
				dtype    : ''
			}
		},
		mounted(){
			this.isWeiXin()			
			this.status = this.$route.query.status			
			let reason = this.$route.query.reason
			if(reason){
				this.reason = reason 
			}
			this.setDesc()
			this.author   = JSON.parse(localStorage.getItem('storeAvatar'))
			this.store    = JSON.parse(localStorage.getItem('avatar'))
		},
		methods:{
			setDesc(){
				let froms = this.$route.query.fromin
				if(froms === 'proxy' && this.status == 1){
					this.dtype = true
				}else if(this.status == 1){
					this.dtype = false
				}
			},
			toU(){
				window.location.href = 'https://www.mofing.com/web/baobao/business.html?uid=255&token=xxx#/xianjin'
			},
			//判断该返回到哪个提交页面
			backPrevPage(){	
				let froms = this.$route.query.fromin
				if(froms === 'media'){					
					this.$router.push({path:'/enterpriseInfo',query:{hasBack:true}})
				}else if(froms === 'onlinestore'){
					this.$router.push({path:'/personalInfo',query:{hasBack:true}})	
				}else if(froms === 'entity'){
					this.$router.push({path:'/setting',query:{hasBack:true}})				
				}else if(froms === 'proxy'){
					this.$router.push({path:'/proxyOpen',query:{hasBack:true}})	
				}else if(froms === 'self'){
					this.$router.push({path:'/selfOpen',query:{hasBack:true}})	
				}else if(froms === 'create'){
					this.$router.push({path:'/createStore',query:{hasBack:true}})	
				}
			},
			isWeiXin(){
				let agent = navigator.userAgent.toLowerCase();
			    if (agent.match(/MicroMessenger/i) == "micromessenger") {
			       	this.isWeChat = false
			       	document.title = '审核结果'
			    } else {
			        this.isWeChat = true
			    }
			}
		}
	}
</script>

<style lang="less" scoped>
	.examine{
		text-align: left;
		background: #fff;
		.header{
			position: relative;
			height: 1.44rem;
			line-height: 2rem;
			text-align: center;
			font-size:.32rem;
			background: #fff;
			.iconfont{
				position: absolute;
				left: 0;
				top: 0;
				padding: 0 .2rem;
			}
		}

		.top{
			position: relative;
			height: 5rem;	
			padding-top: .4rem;		
			background: #fff;
			img{
				display: block;
			}
			.status-title{
				position: absolute;
				bottom: 0;
				width: 100%;
				text-align: center;
				font-size: .6rem;
			}
			.center-img{
				position: absolute;
				left: 50%;
				top: 40%;
				height: 3.6rem;
				width: 3.6rem;
				margin-left: -1.8rem;
				margin-top: -1.4rem;
			}
			.bot-img{
				position: absolute;
				left: 0;
				bottom: 0;
				width: 100%;
			}
			.iconfont{
				position: absolute;
				right: .3rem;
				top: .3rem;
				color: #fff;
			}
		}
		.top-fail{

		}
		.top-succ{

		}
		.bott{
			text-align: center;			
			padding: .5rem 1rem;
			background: #fff;
			.title{
				line-height: .8rem;
				color: #666666;
			}
			.desc{
				text-align: center;
				font-size: .28rem;
				line-height: .48rem;
				color: #4d5b69;
			}
			.desc-fali{
				text-align: left;
			}
			.btn{
				margin-top: .3rem;
				height: .9rem;
				width: 4rem;
				line-height:.9rem ;
				text-align: center;
				background: #fa773d;
				color: #fff;
				border-radius: .5rem;
			}
			.link-img{
				margin-top: 1rem;
				width: 100%;
				height: 2rem;
			}
		}
		.bott-fail{
			.btn{
				margin: .3rem auto;
			}
		}
		.bott-success{
			.logo{
				margin: 0 auto;
				margin-top: .4rem;
				margin-bottom: .4rem;
				height: 1.2rem;
				width: 1.2rem;
			}
			.succ-desc{
				text-align: center;
				font-size: .28rem;
				line-height: .48rem;
				color: #4d5b69;
			}
			.success-btn{
				margin: 0 auto;
				margin-top: .5rem;
				width: 3.8rem;
				height: .8rem;
				text-align: center;
				line-height: .8rem;
				color: #fff;
				background: #5ab148;
				border-radius: .1rem;
			}
		}		
	}
</style>